package com.yusong.test.mybatis;

import com.yusong.test.mybatis.mapper.PersonDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Random;

/**
 * Created by yusong on 2017/3/9.
 * Spring整合MyBatis
 */
public class MybaticMain {

    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("mybatis/spring-mybatis.xml");
        //MapperFactoryBean
        PersonDao personDao=(PersonDao) context.getBean("personDao");
        Random random = new Random(10000);
        Person person=new Person(random.nextInt(),"Fighter168");
        personDao.save(person);
    }


}
